package com.lyf.scm.admin.domain.util;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.lyf.scm.admin.api.dto.RequirementConfirmationDTO;
import com.lyf.scm.admin.domain.excel.dto.RequirementDTO;
import com.lyf.scm.admin.domain.excel.dto.SalesReadDTO;
import com.lyf.scm.common.enums.RequirementPlanTargetEnum;
import com.lyf.scm.common.enums.ResponseMsg;
import com.rome.arch.core.exception.RomeException;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.*;

/**
 * 需求计划导入监听器
 *
 * @author wangchlei
 * @date 2020/11/08
 */
public class OtherPlanDataListener extends AnalysisEventListener<SalesReadDTO> {
    @Override
    public void invoke(SalesReadDTO data, AnalysisContext context) {
    }
    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }
    /**
     * 读取表头数据
     *
     * @param headMap
     * @param context
     * @return void
     **/
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        //获取当前时间周的下一周
        int dateIndex = DateUtil.weekOfYear(new Date()) + 1;
        //获取标题行的信息
        String week = headMap.get(9);
        //校验标题周期是否正确
        if (!week.contains(String.valueOf(dateIndex))) {
            //throw new RomeException(ResponseMsg.FAIL_2045.getCode(), ResponseMsg.FAIL_2045.getMsg());
        }
    }
}
